<?php

namespace common\models;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "{{%link}}".
 *
 * @property string $id
 * @property string $site_url 站点URL
 * @property string $site_name 站点名称
 * @property string $site_content 站点简介
 * @property string $site_img 站点图片
 * @property string $site_motto 站长座右铭
 * @property int $sort 排序
 * @property int $created_at 添加时间
 * @property int $updated_at 修改时间
 */
class Link extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%link}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['site_url', 'site_name', 'site_content', 'site_motto', 'created_at', 'updated_at'], 'required'],
            [['site_content', 'site_img', 'site_motto'], 'string'],
            [['sort', 'created_at', 'updated_at'], 'integer'],
            [['site_url'], 'string', 'max' => 200],
            [['site_name'], 'string', 'max' => 50],
        ];
    }

    /**
     * 设置自动更新时间戳
     * @return array
     */
    public function behaviors()
    {
        return [
            TimestampBehavior::className(),
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => '编号',
            'site_url' => '站点URL',
            'site_name' => '站点名称',
            'site_content' => '站点简介',
            'site_img' => '站点图片',
            'site_motto' => '部长座右铭',
            'sort' => '排序',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
        ];
    }
}
